#include "ros/ros.h"
#include "service_pkg/person.h"

bool personCallback(service_pkg::person::Request &req, service_pkg::person::Response &res)
{
    ROS_INFO("Person: name:%s, age:%d, sex:%d", req.name.c_str(), req.age, req.gender);

    res.result = "OK";

    return true;
}

int main(int argc, char **argv)
{
    ros::init(argc, argv, "person_server");

    ros::NodeHandle n;

    ros::ServiceServer person_service = n.advertiseService("/show_person", personCallback);

    ROS_INFO("Ready to show person information");
    ros::spin();    //循环查看消息队列

    return 0;
}



